package com.ftg.supermarket.comm;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.List;

/**
 * 用来处理前端要要的信息
 *
 * @author 布衣
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class PageEx<T> {

    private Integer pageNum;

    private Integer pageSize;

    private List<T> rows;

    private Integer total;

    private Integer totalPage;

    public Integer getTotalPage(){
        return (int) Math.ceil(new Double(total) / pageSize);
    }

}
